import request from '@/utils/http'

export function addUser (payload) {
  return request({
    url: 'user/insert',
    method: 'post',
    data: payload
  })
}

export function delUser (_id, payload) {
  return request({
    url: 'user/delete',
    method: 'delete',
    data: payload
  })
}

export function updateUser (_id, payload) {
  return request({
    url: 'user/update',
    method: 'put',
    data: payload
  })
}
export function searchUser (payload) {
  return request({
    url: 'user/findByN',
    method: 'get',
    params: payload
  })
}
export function showUser () {
  return request({
    url: 'user/findAll',
    method: 'get'
  })
}

export function findUserByToken () {
  return request({
    url: 'user/findUserByToken',
    method: 'get'
  })
}

export function checkPwd (payload) {
  return request({
    url: 'user/checkPass',
    method: 'post',
    data: payload
  })
}

export function updatePW (payload) {
  return request({
    url: 'user/updatePW',
    method: 'put',
    data: payload
  })
}

export function resetPass (payload) {
  return request({
    url: 'resetPass',
    method: 'post',
    data: payload
  })
}
